package com.neusoft.bizcore.web.dto.result;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;

import io.swagger.annotations.ApiModelProperty;

/**
 * description
 *
 * @author sunchf
 * @date 2018年12月10日 上午9:26:51
 */
public abstract class AbstractResultDTO implements Serializable {

    private static final long serialVersionUID = -3002131656733925925L;

    /**
     * status
     */
    public enum Status {
        success, failure;
    }

    /**
     * result status
     */
    @ApiModelProperty(value = "result status", position = 0)
    protected Status status;

    /**
     * time stamp
     */
    @ApiModelProperty(value = " time stamp", position = 11)
    @JsonInclude(Include.NON_NULL)
    protected Date timestamp;

    @JsonProperty(value = "status", index = 0)
    public Status getStatus() {
        return this.status;
    }

    @JsonIgnore
    public boolean isFailure() {
        return Status.failure == this.status;
    }

    @JsonIgnore
    public boolean isSuccess() {
        return Status.success == this.status;
    }

    public Date getTimestamp() {
        return this.timestamp;
    }

    public void setTimestamp(final Date timestamp) {
        this.timestamp = timestamp;
    }

}
